const Koa = require('koa')
// const router = require('koa-router')()
// const db = require('./utils/database')
const cors = require('koa2-cors')

const bodyParser = require('koa-bodyparser')
const users = require('./routes/users')
const msbd = require('./routes/msbd')
const classify = require('./routes/classify')
const exam = require('./routes/exam')

const app = new Koa()

app.use(cors())
app.use(bodyParser())
app.use(users.routes(), users.allowedMethods())
app.use(msbd.routes(), msbd.allowedMethods())
app.use(classify.routes(), classify.allowedMethods())
app.use(exam.routes(), exam.allowedMethods())
// app.use(users.routes(), users.allowedMethods()

// router.get('/', async function (ctx) {

//     var r = await db.doSQL('select * from classify where id > ? ', [31])
//     console.log(r)

//     ctx.body = 'Hollow koa2'
// })


// app.use(router.routes());
// app.use(router.allowedMethods())

app.listen(3001, () => {
    console.log('starting at port 3001')
})